package com.xh.petdogexpert.user.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xh.petdogexpert.base.BaseController;
import com.xh.petdogexpert.base.BaseException;
import com.xh.petdogexpert.base.ResponseData;
import com.xh.petdogexpert.user.dto.Doctor;
import com.xh.petdogexpert.user.service.IDoctorService;

@Controller
public class DoctorController extends BaseController {

	@Autowired
	IDoctorService doctorService;

	final static Logger logger = LoggerFactory.getLogger(DoctorController.class);
 
	@RequestMapping(value = "doctor/getDoctor")
	@ResponseBody
	public ResponseData getDoctor(Doctor doctor) throws BaseException {

		ResponseData rData = new ResponseData();
		Doctor rDoctor = null;

		rDoctor = doctorService.getDoctor(doctor);
		rData.setData(rDoctor);

		return rData;
	}

	@RequestMapping(value = "doctor/updateDoctor")
	@ResponseBody
	public ResponseData updateDoctor(Doctor doctor) throws BaseException {

		ResponseData rData = new ResponseData();

		int id = doctorService.updateDoctor(doctor);

		rData.setMsg("修改兽医成功");

		rData.data = id;

		return rData;
	}
	
}
